package com.person.webdemoproject2.utils;

import com.person.webdemoproject2.mapper.NotificationMapper;
import com.person.webdemoproject2.pojo.Notification;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class sendNoticeUtils {
    @Autowired
    NotificationMapper notificationMapper;
    public  void sendNotification(int userId, int senderId, String notificationType, String content) {
        Notification notification = new Notification();
        notification.setUserId(userId);
        notification.setSenderId(senderId);
        notification.setNotificationType(notificationType);
        notification.setContent(content);
        notification.setStatus(0); // 新通知默认为未读
        notificationMapper.insertNotification(notification);
    }
}
